#ifndef _ECDATA_H__
#define _ECDATA_H__

#include <cstring>
#include <thread>

#define DATA_BLOCK_NUM_DEFAULT 2

class EcData {
public:
    /* number group of per block. */
    size_t group_count_;
    /* number of servo motors of per group. */
    size_t servo_count_;

private:
    int *curr_ptr_;
    int *next_ptr_;
    int *free_ptr_;

    int *data_blks_;

public:
    EcData(int groupnum);
    ~EcData();
    void Init(int slvnum);
    void DataBlockTransfToCurPtr(void);
    void DataStoreIntoNextBlock(int *data);
    int* DataLoadFromCurrBlock();
    bool DataNextBlockEmpty();
    void Clear();
};
#endif
